<?php
 			/*
			find / -name redis-cli
 			
			/data/redis/bin/redis-cli
 			127.0.0.1:6379> ping
 			PONG
			
			find / -name redis-server
			
			/data/redis/bin/redis-server    start  redis  server 
			nohup /data/redis/bin/redis-server /data/redis/etc/redis.conf &
			service redis start
			
			/data/redis/bin/redis-server stop
			/data/redis/bin/redis-server start
			/data/redis/bin/redis-server    start  redis  server 
			/data/redis/bin/redis-server /data/redis/etc/redis.conf
			nohup /data/redis/bin/redis-server /data/redis/etc/redis.conf &
			service redis start
			/data/redis/bin/redis-server restart
			
			/data/redis/bin/redis-cli shutdown 	
			
			ps aux |grep redis
			netstat -anp|grep redis
			
			ps aux |grep redis
			pkill pid 
			*/
			/*
			pub 
			$redis = new Redis();
			// 第一个参数为redis服务器的ip,第二个为端口
			$res = $redis->connect('127.0.0.1', 6379);
			// test为发布的频道名称,hello,world为发布的消息
			$res = $redis->publish('test','hello,world');
			sub
			$redis = new Redis();
			$res = $redis->pconnect('127.0.0.1', 6379,0);
			$redis->subscribe(array('test'), 'callback');

			// 回调函数,这里写处理逻辑
			function callback($instance, $channelName, $message) {
			 echo $channelName, "==>", $message,PHP_EOL;
			}
			*/
			/*
			 $redis = new Redis();
			 //连接
			 $redis->connect('127.0.0.1', 6379);
			 //列表
			 //存储数据到列表中
			 $redis->lpush('list', 'html');
			 $redis->lpush('list', 'css');
			 //获取列表中所有的值
			$list = $redis->lrange('list', 0, -1);
			//获取列表的长度
			$length = $redis->lsize('list');
			//返回列表key中index位置的值 

			//设置列表中index位置的值 
			$list = $redis->lrange('list', 0, -1); 

			//返回key中从start到end位置间的元素
			$list = $redis->lrange('list', 0, 2); 

			$list = $redis->lgetrange('list', 0, 2); 

			//截取链表中start到end的元素
			//截取列表后列表发生变化,列表保留截取的元素,其余的删除
			$list = $redis->ltrim('list', 0, 1); 

			$list = $redis->lrange('list', 0, -1);
			//删除所有
			$redis->lrem('list', 'html', 0);
			$list = $redis->lrange('list', 0, -1);
			
			
			
			
			/etc/init.d/redis-server stop

			# or
			service redis-server stop
			
			
			redis-cli shutdown #mac
			
			pkill redis
			kill -9 1900
			
			
			*/



?>